﻿using System.Configuration;
using System.Data;
using Microsoft.ApplicationBlocks.Data;

namespace Core.AdminGroupMenuPermission
{
    public class AdminGroupMenuPermissionDAL
    {
        private static readonly string Conn = ConfigurationManager.ConnectionStrings["EventConnectionString"].ToString();

        public static IDataReader AdminGroupMenuPermission_GetByAdminGroupId(int adminGroupId)
        {
            return SqlHelper.ExecuteReader(Conn, "AdminGroupMenuPermission_GetByAdminGroupId", adminGroupId);
        }

        public static IDataReader AdminGroupMenuPermission_GetBy_AdminUserId_AdminMenuId(int adminUserId, int adminMenuId)
        {
            return SqlHelper.ExecuteReader(Conn, "AdminGroupMenuPermission_GetBy_AdminUserId_AdminMenuId", adminUserId, adminMenuId);
        }

        public static IDataReader AdminGroupMenuPermission_GetByAdminGroupIdAdminMenuId(int adminGroupId, int adminMenuId)
        {
            return SqlHelper.ExecuteReader(Conn, "AdminGroupMenuPermission_GetByAdminGroupIdAdminMenuId", adminGroupId, adminMenuId);
        }

        public static void AdminGroupMenuPermission_Create(AdminGroupMenuPermissionObject o)
        {
            SqlHelper.ExecuteScalar(Conn, "AdminGroupMenuPermission_Create", o.AdminGroupId, o.AdminMenuId, o.Status);
        }

        public static void AdminGroupMenuPermission_Delete(int adminGroupId)
        {
            SqlHelper.ExecuteNonQuery(Conn, "AdminGroupMenuPermission_Delete", adminGroupId);
        }
    }
}
